package com.zhizuobiao.coura.utils;

import android.text.TextUtils;

import java.util.regex.Pattern;

/**
 * Created by coura on 2016/12/28.
 */

public class PinyinUtil {

    public static String getFirstLetter(final String pinyin){
        if (TextUtils.isEmpty(pinyin)) return "定位";
        String c = pinyin.substring(0, 1);
        Pattern pattern = Pattern.compile("^[A-Za-z]+$"); //???????
        if (pattern.matcher(c).matches()){
            return c.toUpperCase();
        } else if ("0".equals(c)){
            return "定位";
        } else if ("1".equals(c)){
            return "热门";
        }
        return "定位";
    }
}
